<!--  -->
<template>
   <nav class="navbar navbar-dark bg-primary justify-content-between mb-4 px-4">
    <router-link class="navbar-brand" to="/">者也专栏</router-link>
    <ul v-if="!user.isLogin" class="list-inline mb-0">
      <li class="list-inline-item"><router-link class="btn btn-outline-light my-2" to="/login">登陆</router-link></li>
      <li class="list-inline-item"><router-link class="btn btn-outline-light my-2" to="/register">注册</router-link></li>
    </ul>
    <ul v-else class="list-inline mb-0">
      <li class="list-inline-item">
        <!-- <drop-down :title="`你好${ user.name }`" /> -->
        <!-- 语义化组件封装 -->
        <drop-down :title="`你好${ user.nickName }`">
          <drop-down-item><router-link class="dropdown-item" to="/create">新建文章</router-link></drop-down-item>
          <drop-down-item disabled><a class="dropdown-item" href="#">编辑资料</a></drop-down-item>
          <drop-down-item><a class="dropdown-item" href="#">退出登录</a></drop-down-item>
        </drop-down>
      </li>
    </ul>
  </nav>
</template>

<script lang="ts">
import { defineComponent, PropType, computed } from 'vue'
import DropDown from '@/components/DropDown.vue'
import DropDownItem from '@/components/DropDownItem.vue'
export interface UserProps {
    isLogin: boolean;
    name?: string;
    id?: string;
}
export default defineComponent({
    props: {
        user: {
            type: Object as PropType<UserProps>,
            required: true
        }
    },
    components: {
      DropDown,
      DropDownItem
    }
})

</script>
<style lang='scss' scoped>
</style>